# -*- coding: utf-8 -*-
"""
Created on Mon Aug  2 09:52:47 2021

@author: ZZC
"""
import requests as req
#json专用筛选器 jsonpath Anaconda
import jsonpath

from urllib.request import urlretrieve   #下载器

fk = req.get("https://www.douyu.com/gapi/rknc/directory/yzRec/1")

result = fk.json()

imgs = jsonpath.jsonpath(result, "$..rs1")

names = jsonpath.jsonpath(result, "$..nn")

path="E://engineering_practice//network_security_sp//girls"  #存到哪个地方

for img,name in zip(imgs,names):
    urlretrieve(img,path+"//" +name+ ".png" )
    print(name+"下载成功！")
